package com.example.houseitemmanagebackend.controller;

import com.example.houseitemmanagebackend.entity.Icons;
import com.example.houseitemmanagebackend.service.IconService;
import com.example.houseitemmanagebackend.vo.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 图标管理控制器
 */
@Tag(name = "图标管理", description = "图标管理相关接口")
@RestController
@RequestMapping("/icons")
public class IconController {

    @Autowired
    private IconService iconService;

    @Operation(summary = "获取图标列表", description = "获取图标列表接口")
    @GetMapping
    public Result<List<Icons>> getIconList(@RequestParam(required = false) String category) {
        return Result.success(iconService.getIconList(category));
    }

    @Operation(summary = "获取图标分类", description = "获取图标分类接口")
    @GetMapping("/categories")
    public Result<List<String>> getIconCategories() {
        return Result.success(iconService.getIconCategories());
    }
}